package topevery.syn.data.model;

import java.util.ArrayList;
import java.util.List;

public class EquipmentData {

    public String clientKey;

    /// <summary>
    /// gps数据
    /// 用于网络json传输
    /// </summary>
    public List<GpsData> listGpsData;

    /// <summary>
    /// state数据
    /// 用于网络json传输
    /// </summary>
    public List<StateData> listStateData;

    /// <summary>
    /// 车辆电位数据
    /// 用于网络json传输
    /// </summary>
    public List<WorkData> listWorkData;

    /// <summary>
    /// 水表数据
    /// 用于网络json传输
    /// </summary>
    public List<WaterData> listWaterData;

    /// <summary>
    /// 地磅数据
    /// 用于网络json传输
    /// </summary>
    public List<WeightData> listWeightData;

    /// <summary>
    /// EPC标签数据
    /// 用于网络json传输
    /// </summary>
    public List<EpcClientData> listEpcClientData;

    /// <summary>
    /// 公厕气体数据
    /// 用于网络json传输
    /// </summary>
    public List<PublicToiletGasData> listPublicToiletGasData;

    public List<DeviceNoiseData> listDeviceNoiseData;

    //化粪池
    public List<SepticTankData> listSepticTankData;

    public List<WasteTransferData> listWasteTransferData;

    //评价
    public List<EvaluateData> listEvaluateData;

    //其它气体
    public List<OtherGasData> listOtherGasData;

    //气象站气体
    public List<MeteorologicaData> listMeteorologicaData;

    /// <summary>
    /// 模型数据
    /// </summary>
    public List<ObjectModelData> listObjectModelData;

    public EquipmentData() {
        listGpsData = new ArrayList<>();
        listStateData = new ArrayList<>();

        listWorkData = new ArrayList<>();
        listWaterData = new ArrayList<>();
        listWeightData = new ArrayList<>();
        listEpcClientData = new ArrayList<>();

        listPublicToiletGasData = new ArrayList<>();
        listDeviceNoiseData = new ArrayList<>();

        listObjectModelData = new ArrayList<>();

        listSepticTankData = new ArrayList<>();
        listWasteTransferData = new ArrayList<>();
        listEvaluateData = new ArrayList<>();
        listOtherGasData = new ArrayList<>();
        listMeteorologicaData = new ArrayList<>();
    }

    public EquipmentData(String clientKey) {
        this();
        this.clientKey = clientKey;
    }

    /// <summary>
    /// 获取排序数据进行入库处理
    /// </summary>
    /// <returns></returns>
    public List<IGlbModel> getSortDatas() {
        List<IGlbModel> res = new ArrayList<IGlbModel>();
        for (IGlbModel i : listGpsData) {
            if (i != null) {
                res.add(i);
            }
        }
        for (IGlbModel i : listStateData) {
            if (i != null) {
                res.add(i);
            }
        }
        for (IGlbModel i : listWorkData) {
            if (i != null) {
                res.add(i);
            }
        }
        for (IGlbModel i : listWaterData) {
            if (i != null) {
                res.add(i);
            }
        }
        for (IGlbModel i : listWeightData) {
            if (i != null) {
                res.add(i);
            }
        }
        for (IGlbModel i : listEpcClientData) {
            if (i != null) {
                res.add(i);
            }
        }
        for (IGlbModel i : listDeviceNoiseData) {
            if (i != null) {
                res.add(i);
            }
        }

        for (IGlbModel i : listPublicToiletGasData) {
            if (i != null) {
                res.add(i);
            }
        }

        for (IGlbModel i : listObjectModelData) {
            if (i != null) {
                res.add(i);
            }
        }

        for (IGlbModel i : listSepticTankData) {
            if (i != null) {
                res.add(i);
            }
        }

        for (IGlbModel i : listWasteTransferData) {
            if (i != null) {
                res.add(i);
            }
        }

        for (IGlbModel i : listEvaluateData) {
            if (i != null) {
                res.add(i);
            }
        }
        for (IGlbModel i : listOtherGasData) {
            if (i != null) {
                res.add(i);
            }
        }
        for (IGlbModel i : listMeteorologicaData) {
            if (i != null) {
                res.add(i);
            }
        }

//        res.sort(new Comparator<IGlbModel>() {
//            @Override
//            public int compare(IGlbModel x, IGlbModel y) {
//                if (x.getGid() > y.getGid()) {
//                    return 1;
//                } else if (x.getGid() == y.getGid()) {
//                    return 0;
//                } else {
//                    return -1;
//                }
//            }
//        });
        return res;
    }

    private void add(List<IGlbModel> list1, List<IGlbModel> list2) {
        if (list2 != null) {
            list1.addAll(list2);
        }
    }
}
